#ifndef _ARCH_IO_H
#define _ARCH_IO_H

#define dmb()			__asm__ __volatile__ ("" : : : "memory")
#define __iormb()		dmb()
#define __iowmb()		dmb()

#define readb(a)		({ u8  __v = (*(volatile unsigned char *)(a)); __iormb(); __v; })
#define readw(a)		({ u16 __v = (*(volatile unsigned short *)(a)); __iormb(); __v; })
#define readl(a)		({ u32 __v = (*(volatile unsigned int *)(a)); __iormb(); __v; })

#define writeb(v, a)	({ u8  __v = v; __iowmb(); (*(volatile unsigned char *)(a) = (v)); __v; })
#define writew(v, a)	({ u16 __v = v; __iowmb(); (*(volatile unsigned short *)(a) = (v)); __v; })
#define writel(v, a)	({ u32 __v = v; __iowmb(); (*(volatile unsigned int *)(a) = (v)); __v; })

#endif /* _ARCH_IO_H */
